<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>loginDemo</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" >
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" >
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" ></script>
</head>
<body>
    <input type="button" value="登陆" id="btnLogin" class="btn btn-default">
    <input type="text" id="textLogin" placeholder="请输入用户名">

    <script>
        window.onload=function () {
            const btnLogin=document.getElementById("btnLogin");
            const textLogin=document.getElementById("textLogin");

            btnLogin.onclick=function () {
                if (1){
                    window.location.href="loginServlet";
                }else{
                    alert("测试用户名：admin")
                }
            }
        }
    </script>
</body>
</html>